/*
传入一个数组 nums 和一个数字 target，返回数组中两个数的下标，使之两个数之和为 target
*/

(function(win) {
	function twoSum(nums, target) {
		for (var i = 0; i < nums.length - 1; i++) {
			for (var j = i + 1; j < nums.length; j++) {
				if (nums[i] + nums[j] == target) {
					return [i, j];
				}
			}
		}
	}
	var arr = [1, 4, 7, 8, 15, 9, 45, 76, 14, 21];
	var num = 16;
	console.log(twoSum(arr, num));
})(window)